package org.lc.platform.mybatis.manager.util;

import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;

public class ManagerUtil {


    public static Class<?> getClsByField(Field f) {
        if (f.getType().equals(List.class)) {
            Type genericType = f.getGenericType();
            if (genericType instanceof ParameterizedType pt) {
                // 得到泛型里的class类型对象
                return (Class<?>) (pt.getActualTypeArguments()[0]);
            }
        }
        return f.getType();
    }
}
